﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TicketingCompany
{
    public partial class Purchases : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                RepeaterEvents.DataSource = GetOperations.GetIncomingEvents();
                RepeaterEvents.DataBind();
                //make it back IQueryable
            }
        }

        protected string GetLocationByID()
        {
            int id = (int)Eval("LocationID");
            return Server.HtmlEncode(GetOperations.GetLocationNameByID(id));
        }

        protected string GetCategoryByID()
        {
            int id = (int)Eval("CategoryID");
            return Server.HtmlEncode(GetOperations.GetCategoryNameByID(id));
        }

        protected string SafeEval(string propName)
        {
            return Server.HtmlEncode(Eval(propName).ToString());
        }

        protected void ButtonPurchase_OnCommand(object sender, CommandEventArgs e)
        {
            Server.Transfer("~/Public/PurchaseTicket.aspx?id=" + e.CommandArgument.ToString());
        }
    }
}